/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo.conexion;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author Andrés
 */
public class GestorConexion {

    private static GestorConexion instancia = null;
    public static final String url = "jdbc:oracle:thin:@localhost:1521:XE";

    private GestorConexion() {
    }

    public static GestorConexion obtieneInstancia() {

        if (instancia == null) {
            instancia = new GestorConexion();
        }
        return instancia;
    }

    public Connection obtieneConexion(String usuario, String password, String puerto) throws ClassNotFoundException, SQLException {

        Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection conexion = (Connection) DriverManager.getConnection("jdbc:oracle:thin:@localhost:" + puerto + ":XE", "sys as sysdba", "system");
        conexion.setAutoCommit(false);
        return conexion;
    }
}
